package com.polytech.tablespaceResolver.ORMUtils;

public class DBCredentials {
	String host;
	String port;
	String dbName;
	String login;
	String password;
	String schema;
	
	private DBCredentials(Builder builder) {
		this.host = builder.host;
		this.port = builder.port;
		this.dbName = builder.dbName;
		this.login = builder.login;
		this.password = builder.password;
		this.schema = builder.schema;
	}
	
	public static class Builder {
		private String host;
		private String port;
		private String dbName;
		private String login;
		private String password;
		private String schema;
		
		public Builder setHost(String host) {
			this.host = host;
			return this;
		}
		public Builder setPort(String port) {
			this.port = port;
			return this;
		}
		public Builder setDbName(String dbName) {
			this.dbName = dbName;
			return this;
		}
		public Builder setLogin(String login) {
			this.login = login;
			return this;
		}
		public Builder setPassword(String password) {
			this.password = password;
			return this;
		}
		public Builder setSchema(String schema) {
			this.schema = schema;
			return this;
		}
		public DBCredentials build()
		{
			return new DBCredentials(this);
		}
	}

	public String getHost() {
		return host;
	}

	public String getPort() {
		return port;
	}

	public String getDbName() {
		return dbName;
	}

	public String getLogin() {
		return login;
	}

	public String getPassword() {
		return password;
	}

	public String getSchema() {
		return schema;
	}

	public String getConnectionString()
	{
		return "jdbc:postgresql://" + host + ":" + port + "/" + dbName;
	}
}
